package cn.gson.crm.control.follow;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSONArray;

import cn.gson.crm.control.base.BaseServlet;
import cn.gson.crm.model.dao.FollowDao;
import cn.gson.crm.model.po.FollowPo;
@WebServlet("/follow/readcon")
public class FollowReadContentServlet extends BaseServlet{
		private FollowDao followDao = new FollowDao();
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Override
	protected void post(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String id = request.getParameter("id");
		FollowPo followpo  = followDao.getOneFollowPoList(id);
		response.setContentType("application/json;charset=utf-8");
    	String jsonStr = JSONArray.toJSONString(followpo);
        //输出结果
        response.getWriter().append(jsonStr);
	}
	
	@Override
	protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String id = request.getParameter("id");
		String followcon = request.getParameter("followContent");
		followDao.updateFollowContent(id, followcon);
		redirect("follow/read");
	}
}
